package com.study.it.aop;

import com.study.it.util.LoadUtil;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.AfterReturningAdvice;

import java.lang.reflect.Method;

public class HibernateLoadDataAdvice implements AfterReturningAdvice {
    @Override
    public void afterReturning(Object rval, Method method, Object[] objects, Object target) throws Throwable {
        //专用于返回前的动作
        System.out.println("进入hb加载器");
        if(rval!=null)
           LoadUtil.init(rval);
    }
//    @Override
//    public Object invoke(MethodInvocation inv) throws Throwable {
//        System.out.println("进入hb加载器");
//        Object o=inv.proceed();
//        LoadUtil.init(o);
//        return o;
//    }
}
